home *** CD-ROM | disk | FTP | other *** search
/ Visual Cafe 3 / Visual Cafe 3.ISO / Vcafe / Main.bin / StringTableModel.java < prev    next >
Text File  |  1998-09-28  |  21KB  |  845 lines

  1. package com.symantec.itools.swing.models;
  2.  
  3. import java.io.Serializable;
  4. import java.util.Enumeration;
  5. import java.util.Vector;
  6. import java.util.StringTokenizer;
  7. import com.sun.java.swing.event.TableModelEvent;
  8. import java.math.*;
  9.  
  10. public class StringTableModel
  11.     extends com.sun.java.swing.table.AbstractTableModel
  12.     implements Serializable
  13. {
  14.  
  15.     /**
  16.      * The number of columns currently in the table.
  17.      * This is equal to the widest row of data.
  18.      * The column headers are pinned (padded or truncated) to the width of the data
  19.      */
  20.     protected int colCount = 0;
  21.  
  22.     /**
  23.      * A Vector of Vectors containing the table's data
  24.      */
  25.     protected Vector dataVector = new Vector();
  26.  
  27.     /**
  28.      * A vector of vectors containg booleans indicating editability of
  29.      * each cell in the table.
  30.      */
  31.     protected Vector editableVector = new Vector();
  32.  
  33.     /**
  34.      * A vector containing the column headers
  35.      */
  36.     protected Vector headerVector = new Vector();
  37.  
  38.     /**
  39.      * A boolean indicating whether the table in general is editable.
  40.      */
  41.     protected boolean editable = false;
  42.  
  43.     //
  44.     // com.sun.java.swing.table.TableModel implementation
  45.     //
  46.  
  47.     /**
  48.      * Returns the number of rows in the table.
  49.      * @return The number of rows in the table.
  50.      */
  51.     public int getRowCount()
  52.     {
  53.         return dataVector.size();
  54.     }
  55.  
  56.     /**
  57.      * Returns the number of columns in the table.
  58.      * @return The number of columns in the table.
  59.      */
  60.     public int getColumnCount()
  61.     {
  62.         return colCount;
  63.     }
  64.  
  65.     /**
  66.      * Returns the header for specified column.
  67.      * May be space (padded)
  68.      * @param column The specified column
  69.      * @return The header for specified column.
  70.      */
  71.     public String getColumnName(int column)
  72.     {
  73.         return (String)headerVector.elementAt(column);
  74.     }
  75.  
  76.     /**
  77.      * Returns the class of the type of object held in this column.
  78.      * In this model, it it always String
  79.      * @param columnIndex The specified column
  80.      * @return String.class
  81.      */
  82.     public Class getColumnClass(int columnIndex)
  83.     {
  84.         return String.class;
  85.     }
  86.  
  87.     /**
  88.      * Returns the value in the specified cell
  89.      * @param row The specified row.
  90.      * @param column The specified column
  91.      * @return The value in the specified cell
  92.      */
  93.     public Object getValueAt(int row, int column)
  94.     {
  95.         return ((String)((Vector)dataVector.elementAt(row)).elementAt(column));
  96.     }
  97.  
  98.     /**
  99.      * Set the value for a specified cell
  100.      * @param aValue The object value to set the specified cell to.
  101.      * Should be a string for this model.
  102.      * @param row The specified row.
  103.      * @param column The specified column
  104.      */
  105.     public void setValueAt(Object aValue, int row, int column)
  106.     {
  107.         ((Vector)dataVector.elementAt(row)).setElementAt(aValue, column);
  108.         ((Vector)editableVector.elementAt(row)).setElementAt(Boolean.TRUE, column);
  109.         fireTableCellUpdated(row, column);
  110.     }
  111.  
  112.     /**
  113.      * Set the editability of the specified cell.
  114.      * @param rowIndex The specified row.
  115.      * @param columnIndex The specified column
  116.      * @param f True or false.
  117.      */
  118.     public void setCellEditable(int rowIndex, int columnIndex, boolean f)
  119.     {
  120.         Vector data;
  121.  
  122.         data = (Vector)editableVector.elementAt(rowIndex);
  123.         data.setElementAt(new Boolean(f), columnIndex);
  124.     }
  125.  
  126.     /**
  127.      * Is the cell editable?
  128.      * @param rowIndex The specified row
  129.      * @param columnIndex The specified column
  130.      * @return true if cell is editable
  131.      */
  132.     public boolean isCellEditable(int rowIndex, int columnIndex)
  133.     {
  134.         Vector data;
  135.  
  136.         data = (Vector)editableVector.elementAt(rowIndex);
  137.  
  138.         return (((Boolean)data.elementAt(columnIndex)).booleanValue());
  139.     }
  140.  
  141.     //
  142.     // Properties
  143.     //
  144.  
  145.     /**
  146.      * Calls getItems(char)
  147.      * @return An array of comma-delimited strings representing the
  148.      * data in the table.
  149.      */
  150.     public String[] getItems()
  151.     {
  152.         return (getItems(','));
  153.     }
  154.  
  155.     /**
  156.      * Called by getItems(). Constructs the array of
  157.      * comma-delimited string from the data in dataVector.
  158.      * @param appendChar a comma
  159.      * @return An array of comma-delimited strings representing the
  160.      * data in the table.
  161.      */
  162.     public String[] getItems(char appendChar)
  163.     {
  164.         int rowCount;
  165.         String[] items;
  166.  
  167.         rowCount = dataVector.size();
  168.         items = new String[rowCount];
  169.  
  170.         for(int i = 0; i < rowCount; i++)
  171.         {
  172.             StringBuffer row;
  173.  
  174.             row = new StringBuffer();
  175.  
  176.             for(int j = 0; j < colCount;j++)
  177.             {
  178.                 row.append(((Vector)dataVector.elementAt(i)).elementAt(j));
  179.                 row.append(appendChar);
  180.             }
  181.  
  182.             // strip trailing appendChar off.
  183.             row.setLength(row.length() - 1);
  184.  
  185.             items[i] = row.toString();
  186.         }
  187.  
  188.         return items;
  189.     }
  190.  
  191.     /**
  192.      * Calls setItems(String[],String).
  193.      * @param newItems An array of comma-delimited strings holding the
  194.      * data for the table.
  195.      */
  196.     public void setItems(String[] newItems)
  197.     {
  198.         setItems(newItems, ",");
  199.     }
  200.  
  201.     /**
  202.      * Parses the  String array, one row at a time, via a stringtokenizer
  203.      * by calling setItemAt(String,int,boolean,String)
  204.      * @param newItems The string array of data
  205.      * @param sepChar The comma delimiter
  206.      */
  207.     public void setItems(String[] newItems, String sepChar)
  208.     {
  209.         int rowCount;
  210.         colCount = 0;
  211.         dataVector.setSize(0);
  212.  
  213.         // cycle through rows
  214.         for(int i = 0; i < newItems.length;i++)
  215.         {
  216.             setItemAt(newItems[i], i, false, sepChar);
  217.         }
  218.  
  219.         rowCount = dataVector.size();
  220.  
  221.         // pad any short rows
  222.         for(int k = 0; k < rowCount;k++)
  223.         {
  224.             int rowWidth = ((Vector)dataVector.elementAt(k)).size();
  225.  
  226.             if(rowWidth < colCount)
  227.             {
  228.                 int padding;
  229.  
  230.                 padding = colCount - rowWidth;
  231.  
  232.                 for(int l = 0; l < padding; l++)
  233.                 {
  234.                     ((Vector)dataVector.elementAt(k)).addElement("");
  235.                 }
  236.             }
  237.         }
  238.  
  239.         // Generate notification
  240.         fireTableStructureChanged();
  241.     }
  242.  
  243.     /**
  244.      * Calls setItemAt(String,int,boolean,String)
  245.      * @param item A comma-delimited string representing a row of data
  246.      * @param row The specified row.
  247.      * @param notifyOfChange Whether or not to broadcast an event.
  248.      */
  249.     public void setItemAt(String item, int row, boolean notifyOfChange)
  250.     {
  251.         setItemAt(item, row, notifyOfChange, ",");
  252.     }
  253.  
  254.     /**
  255.      * Puts the item value (row of data) into dataVector
  256.      * Pads any short rows to the widest row with a space.
  257.      * @param item A comma-delimited string representing a row of data
  258.      * @param row The specified row.
  259.      * @param notifyOfChange Whether or not to broadcast an event.
  260.      * @param sepChar The comma delimiter.
  261.      */
  262.     public void setItemAt(String item, int row, boolean notifyOfChange, String sepChar)
  263.     {
  264.         StringTokenizer newRow;
  265.  
  266.         dataVector.insertElementAt(new Vector(), row);
  267.         editableVector.insertElementAt(new Vector(), row);
  268.         newRow = new StringTokenizer(item, sepChar);
  269.         colCount = Math.max(colCount,newRow.countTokens());
  270.  
  271.         // columns
  272.         while(newRow.hasMoreTokens())
  273.         {
  274.             int    rowWidth;
  275.             String rowItem;
  276.  
  277.             rowItem = newRow.nextToken();
  278.             ((Vector)dataVector.elementAt(row)).addElement(rowItem);
  279.             ((Vector)editableVector.elementAt(row)).addElement(Boolean.TRUE);
  280.             rowWidth = ((Vector)dataVector.elementAt(row)).size();
  281.             if(rowWidth > headerVector.size())
  282.             {
  283.                 headerVector.addElement(" ");
  284.             }
  285.         }
  286.  
  287.         if(notifyOfChange)
  288.         {
  289.             fireTableDataChanged();
  290.         }
  291.  
  292.     }
  293.  
  294.     /**
  295.      * Calls getColumnHeaders(char)
  296.      * @return A comma-delimited string containing the columnHeaders
  297.      */
  298.     public String getColumnHeaders()
  299.     {
  300.         return (getColumnHeaders(','));
  301.     }
  302.  
  303.     /**
  304.      * Constructs a comma-delimited string from headerVector
  305.      * @param sepChar String - The comma delimiter
  306.      * @return A comma-delimited string containing the columnHeaders
  307.      */
  308.     public String getColumnHeaders(char sepChar)
  309.     {
  310.         StringBuffer colHeaders = new StringBuffer();
  311.  
  312.         for (int j = 0; j < colCount;j++)
  313.         {
  314.             colHeaders.append((String)headerVector.elementAt(j));
  315.             colHeaders.append(sepChar);
  316.         }
  317.  
  318.         // remove trailing sepChar
  319.         if (colHeaders.length() > 0)
  320.             colHeaders.setLength(colHeaders.length() - 1);
  321.  
  322.         return colHeaders.toString();
  323.     }
  324.  
  325.     /**
  326.      * Calls setcolumnHeaders(String,String)
  327.      * @param newHeaders A comma-delimited string containing the column headers
  328.      */
  329.     public void setColumnHeaders(String newHeaders)
  330.     {
  331.         setColumnHeaders(newHeaders, ",");
  332.     }
  333.  
  334.     /**
  335.      * Sets the column headers.
  336.      * If newHeaders is shorter than colCount
  337.      * then the headerVector is padded with spaces.
  338.      * If newHeaders is longer than colCount, they will be stored but
  339.      * not displayed by JTable.
  340.      * @param newHeaders A comma-delimited string containing the column headers
  341.      * @param sepChar String - The comma delimiter
  342.      */
  343.     public void setColumnHeaders(String newHeaders, String sepChar)
  344.     {
  345.         headerVector = new Vector();
  346.         StringTokenizer headers = new StringTokenizer(newHeaders,sepChar);
  347.         int newHeadersWidth = headers.countTokens();
  348.         for (int j = 0; j < Math.max(newHeadersWidth,colCount); j++)
  349.             {
  350.                 if(headers.hasMoreTokens())
  351.                     {
  352.                         headerVector.addElement(headers.nextToken());
  353.                     }
  354.  
  355.                 else
  356.                    {
  357.                     headerVector.addElement(" ");
  358.                    }
  359.  
  360.             }
  361.  
  362.         fireTableStructureChanged();
  363.         fireTableDataChanged();
  364.     }
  365.  
  366.     /**
  367.      * Is the table in general editable?
  368.      * @return true if table is editable
  369.      */
  370.     public boolean isEditable()
  371.     {
  372.         return editable;
  373.     }
  374.  
  375.     /**
  376.      * Sets whether or not the table in general is editable.
  377.      * @param isEditable boolean
  378.      */
  379.     public void setEditable(boolean isEditable)
  380.     {
  381.         editable = isEditable;
  382.     }
  383.  
  384.     /**
  385.      * Calls getRow(int,char)
  386.      * Get a particular row of data.
  387.      * @param row The specified row.
  388.      * @return A comma delimited string containg the elements in the specified row.
  389.      */
  390.     public String getRow(int row)
  391.     {
  392.         return getRow(row, ',');
  393.     }
  394.  
  395.     /**
  396.      * Get a particular row of data.
  397.      * @param row The specified row.
  398.      * @param appendChar a comma
  399.      * @return A comma delimited string containing the elements in the specified row.
  400.      */
  401.     public String getRow(int row, char appendChar)
  402.     {
  403.         StringBuffer buf;
  404.  
  405.         buf = new StringBuffer();
  406.  
  407.         for(Enumeration e = elements(row); e.hasMoreElements();)
  408.         {
  409.             buf.append((String)e.nextElement());
  410.             buf.append(appendChar);
  411.         }
  412.  
  413.         // remove trailing appendChar
  414.         buf.setLength(buf.length() - 1);
  415.  
  416.         return (buf.toString());
  417.     }
  418.  
  419.     //
  420.     // helper methods
  421.     //
  422.  
  423.     /**
  424.      * Add a row of data. Calls insertRowAt(String,int)
  425.      * @param data A comma-delimited string.
  426.      */
  427.     public void addRow(String data)
  428.     {
  429.         insertRowAt(data, dataVector.size());
  430.     }
  431.  
  432.     /**
  433.      * Calls setItemAt(string,int,boolean)
  434.      * @param data A comma-delimited string.
  435.      * @param row The specified row.
  436.      */
  437.     public void insertRowAt(String data, int row)
  438.     {
  439.         setItemAt(data, row, false);
  440.         fireTableRowsInserted(row, row);
  441.     }
  442.  
  443.     /**
  444.      * Removes the specified row from dataVector
  445.      * @param row The specified row.
  446.      */
  447.     public void removeRow(int row)
  448.     {
  449.         dataVector.removeElementAt(row);
  450.         fireTableRowsDeleted(row, row);
  451.     }
  452.  
  453.     /**
  454.      * Returns the number of rows in dataVector.
  455.      * @return The number of rows
  456.      */
  457.     public int getNumRows()
  458.     {
  459.         return (dataVector.size());
  460.     }
  461.  
  462.     //
  463.     // Vector like methods
  464.     //
  465.  
  466.     /**
  467.      * Gets the value from a particular cell.
  468.      * @param row The specified row
  469.      * @param col The specified column
  470.      * @return The value from a particular cell.
  471.      */
  472.     public Object getElementAt(int row, int col)
  473.     {
  474.         Vector data;
  475.  
  476.         data = (Vector)dataVector.elementAt(row);
  477.  
  478.         return (data.elementAt(col));
  479.     }
  480.  
  481.     /**
  482.      * Fills anArray with corresponding values in dataVector by  calling
  483.      * getElementAt(int,int)
  484.      * @param anArray Object array
  485.      */
  486.     public void copyInto(Object anArray[][])
  487.     {
  488.         for(int i = 0; i < anArray.length; i++)
  489.         {
  490.             for(int j = 0; j < anArray[i].length; j++)
  491.             {
  492.                 anArray[i][j] = elementAt(i, j);
  493.             }
  494.         }
  495.     }
  496.  
  497.     /**
  498.      * Calls the Vector.trimToSize() on the specified row in dataVector
  499.      * @param row The specified row
  500.      */
  501.     public void trimToSize(int row)
  502.     {
  503.         Vector data;
  504.  
  505.         data = (Vector)dataVector.elementAt(row);
  506.         data.trimToSize();
  507.     }
  508.  
  509.     /**
  510.      * Calls the Vector.ensureCapacity() on the specified row in dataVector
  511.      * @param minCapacity The required capacity
  512.      * @param row The specified row
  513.      */
  514.     public void ensureCapacity(int minCapacity, int row)
  515.     {
  516.         Vector data;
  517.  
  518.         data = (Vector)dataVector.elementAt(row);
  519.         data.ensureCapacity(minCapacity);
  520.     }
  521.  
  522.     /**
  523.      * Calls the Vector.setSize() on the specified row in dataVector
  524.      * @param newSize The new size
  525.      * @param row The specified row
  526.      */
  527.     public void setSize(int newSize, int row)
  528.     {
  529.         int oldSize;
  530.         Vector data;
  531.  
  532.         data    = (Vector)dataVector.elementAt(row);
  533.         oldSize = data.size();
  534.         data.setSize(newSize);
  535.  
  536.         if(oldSize != newSize)
  537.         {
  538.             fireTableRowsUpdated(row, row);
  539.         }
  540.     }
  541.  
  542.     /**
  543.      * Calls the Vector.Capacity() on the specified row in dataVector
  544.      * @param row The specified row
  545.      * @return The current capacity of the specified row
  546.      */
  547.     public int capacity(int row)
  548.     {
  549.         Vector data;
  550.  
  551.         data = (Vector)dataVector.elementAt(row);
  552.  
  553.         return (data.capacity());
  554.     }
  555.  
  556.     /**
  557.      * Calls the Vector.Size() on  dataVector
  558.      * @return The current size (number of rows) of dataVector.
  559.      */
  560.     public int size()
  561.     {
  562.         return (dataVector.size());
  563.     }
  564.  
  565.     /**
  566.      * Calls the Vector.Size() on the specified row in dataVector
  567.      * @param row The specified row
  568.      * @return The current size of the specified row
  569.      */
  570.     public int size(int row)
  571.     {
  572.         Vector data;
  573.  
  574.         data = (Vector)dataVector.elementAt(row);
  575.  
  576.         return (data.size());
  577.     }
  578.  
  579.     /**
  580.      * Calls the Vector.isEmpty() on the specified row in dataVector
  581.      * @param row The specified row
  582.      * @return Whether or not the specified row is empty.
  583.      */
  584.     public boolean isEmpty(int row)
  585.     {
  586.         Vector data;
  587.  
  588.         data = (Vector)dataVector.elementAt(row);
  589.  
  590.         return (data.isEmpty());
  591.     }
  592.  
  593.     /**
  594.      * Calls the Vector.elements() on the specified row in dataVector
  595.      * @param row The specified row
  596.      * @return The specified row as an enumeration
  597.      */
  598.     public Enumeration elements(int row)
  599.     {
  600.         Vector data;
  601.  
  602.         data = (Vector)dataVector.elementAt(row);
  603.  
  604.         return (data.elements());
  605.     }
  606.  
  607.     /**
  608.      * Calls the Vector.contains() on the specified row in dataVector
  609.      * @param elem The specified object
  610.      * @param row The specified row
  611.      * @return Whether or not the specified row contains the specified object
  612.      */
  613.     public boolean rowContains(Object elem, int row)
  614.     {
  615.         Vector data;
  616.  
  617.         data = (Vector)dataVector.elementAt(row);
  618.  
  619.         return (data.contains(elem));
  620.     }
  621.  
  622.     /**
  623.      * Determines whether the specified column contains the specified object.
  624.      * @param elem The specified object
  625.      * @param col The specified column
  626.      * @return Whether the specified column contains the specified object.
  627.      */
  628.     public boolean columnContains(Object elem, int col)
  629.     {
  630.         int size;
  631.  
  632.         size = size();
  633.  
  634.         for(int i = 0; i < size; i++)
  635.         {
  636.             if(((Vector)dataVector.elementAt(i)).elementAt(col).equals(elem))
  637.             {
  638.                 return (true);
  639.             }
  640.         }
  641.  
  642.         return (false);
  643.     }
  644.  
  645.     /**
  646.      * Calls the Vector.indexOf(object) on the specified row in dataVector
  647.      * @param elem The specified object
  648.      * @param row The specified row
  649.      * @return The index of the spcified object in the specified row
  650.      */
  651.     public int indexOf(Object elem, int row)
  652.     {
  653.         Vector data;
  654.  
  655.         data = (Vector)dataVector.elementAt(row);
  656.  
  657.         return (data.indexOf(elem));
  658.     }
  659.  
  660.     /**
  661.      * Calls the Vector.indexOf(object,int) on the specified row in dataVector
  662.      * @param elem The specified object
  663.      * @param row The specified row
  664.      * @param col The specified column
  665.      * @return The index of the spcified object in the specified row, but
  666.      * begins the search at the specified column.
  667.      */
  668.     public int indexOf(Object elem, int row, int col)
  669.     {
  670.         Vector data;
  671.  
  672.         data = (Vector)dataVector.elementAt(row);
  673.  
  674.         return (data.indexOf(elem, col));
  675.     }
  676.  
  677.     /**
  678.      * Calls the Vector.lastIndexOf(object) on the specified row in dataVector
  679.      * @param elem The specified object
  680.      * @param row The specified row
  681.      * @return The last occurrence of elem in the specified row.
  682.      */
  683.     public int lastIndexOf(Object elem, int row)
  684.     {
  685.         Vector data;
  686.  
  687.         data = (Vector)dataVector.elementAt(row);
  688.  
  689.         return (data.lastIndexOf(elem));
  690.     }
  691.  
  692.     /**
  693.      * Calls the Vector.lastIndexOf(object,int) on the specified row in dataVector
  694.      * @param elem The specified object
  695.      * @param row The specified row
  696.      * @param col The specified column
  697.      * @return The last occurrence of elem in the specified row, searching backwards
  698.      * from the specified index
  699.      */
  700.     public int lastIndexOf(Object elem, int row, int col)
  701.     {
  702.         Vector data;
  703.  
  704.         data = (Vector)dataVector.elementAt(row);
  705.  
  706.         return (data.lastIndexOf(elem, col));
  707.     }
  708.  
  709.     /**
  710.      * Calls the Vector.elementAt() on the specified row in dataVector
  711.      * @param row The specified row
  712.      * @param col The specified column
  713.      * @return The object at the specified row and column.
  714.      */
  715.     public Object elementAt(int row, int col)
  716.     {
  717.         Vector data;
  718.  
  719.         data = (Vector)dataVector.elementAt(row);
  720.  
  721.         return (data.elementAt(col));
  722.     }
  723.  
  724.     /**
  725.      * Calls the Vector.firstElement() on the specified row in dataVector
  726.      * @param row The specified row
  727.      * @return The first element in the specified row of dataVector
  728.      */
  729.     public Object firstElement(int row)
  730.     {
  731.         Vector data;
  732.  
  733.         data = (Vector)dataVector.elementAt(row);
  734.  
  735.         return (data.firstElement());
  736.     }
  737.  
  738.     /**
  739.      * Calls the Vector.lastElement() on the specified row in dataVector
  740.      * @param row The specified row
  741.      * @return The last element in the specified row of dataVector
  742.      */
  743.     public Object lastElement(int row)
  744.     {
  745.         Vector data;
  746.  
  747.         data = (Vector)dataVector.elementAt(row);
  748.  
  749.         return (data.lastElement());
  750.     }
  751.  
  752.     /**
  753.      * Calls the Vector.setElementAt() on the specified row in dataVector
  754.      * @param obj object - the value to set
  755.      * @param row The specified row
  756.      * @param col The specified column
  757.      */
  758.     public void setElementAt(Object obj, int row, int col)
  759.     {
  760.         Vector data;
  761.  
  762.         data = (Vector)dataVector.elementAt(row);
  763.         data.setElementAt(obj, col);
  764.           fireTableRowsUpdated(row, row);
  765.     }
  766.  
  767.     /**
  768.      * Calls the Vector.removeElementAt() on the specified row in dataVector
  769.      * @param row Removes the value at the specified cell row, and
  770.      * @param col the specified column
  771.      */
  772.     public void removeElementAt(int row, int col)
  773.     {
  774.         Vector data;
  775.  
  776.         data = (Vector)dataVector.elementAt(row);
  777.         data.removeElementAt(col);
  778.            fireTableRowsUpdated(row, row);
  779.     }
  780.  
  781.     /**
  782.      * Calls the Vector.insertElementAt() on the specified row in dataVector
  783.      * @param obj The value to set.
  784.      * @param row the specified row
  785.      * @param col the specified column
  786.      */
  787.     public void insertElementAt(Object obj, int row, int col)
  788.     {
  789.         Vector data;
  790.  
  791.         data = (Vector)dataVector.elementAt(row);
  792.         data.insertElementAt(obj, col);
  793.            fireTableRowsUpdated(row, row);
  794.     }
  795.  
  796.     /**
  797.      * Calls the Vector.addElement() on the specified row in dataVector
  798.      * @param obj The value to add
  799.      * @param row The specified row
  800.      */
  801.     public void addElement(Object obj, int row)
  802.     {
  803.         Vector data;
  804.  
  805.         data = (Vector)dataVector.elementAt(row);
  806.         data.addElement(obj);
  807.            fireTableRowsUpdated(row, row);
  808.     }
  809.  
  810.     /**
  811.      * Calls the Vector.removeElement() on the specified row in dataVector
  812.      * @param obj The value to remove. Removes only the first occurence.
  813.      * @param row The specified row
  814.      * @return Whether or not the value was found
  815.      */
  816.     public boolean removeElement(Object obj, int row)
  817.     {
  818.         Vector  data;
  819.         boolean rv;
  820.  
  821.         data = (Vector)dataVector.elementAt(row);
  822.         rv   = data.removeElement(obj);
  823.  
  824.         if(rv)
  825.         {
  826.                fireTableRowsUpdated(row, row);
  827.         }
  828.  
  829.         return (rv);
  830.     }
  831.  
  832.     /**
  833.      * Calls the Vector.removeAllElements() on the specified row in dataVector
  834.      * @param row The specified row
  835.      */
  836.     public void removeAllElements(int row)
  837.     {
  838.         Vector data;
  839.  
  840.         data = (Vector)dataVector.elementAt(row);
  841.         data.removeAllElements();
  842.            fireTableRowsUpdated(row, row);
  843.     }
  844. }
  845.